<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="common/commonLayout.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:metadata>
        <f:viewParam name="storageId" value="#{packageDetails.storageName}" validator="#{validator.validateStorageId}"/>
        <f:viewParam name="packageId" value="#{packageDetails.packageId}"/>
        <f:viewParam name="packageVersion" value="#{packageDetails.packageVersion}"/>
        <f:event type="preRenderView" listener="#{packageDetails.init()}" />
        <f:event type="preRenderView" listener="#{language.setUserLocale()}"/>
    </f:metadata>
    <ui:define name="title"><h:outputText value="Детальная информация о пакете #{packageDetails.packageId} #{packageDetails.packageVersion}"/></ui:define>
    <ui:define name="content">
        <h:graphicImage value="#{packageDetails.iconUrl}"/>
        <ul>
            <li><h:outputText value="Идентификатор пакета #{packageDetails.packageId}"/> </li>
            <li><h:outputText value="Версия пакета #{packageDetails.packageVersion}"/> </li>
            <li><h:outputText value="Описание пакета #{packageDetails.description}"/> </li>
            <li><h:outputText value="Размер пакета #{packageDetails.size} Мб"/> </li>
            <li><h:outputText value="Заголовок пакета #{packageDetails.title}"/></li>
            <li><h:outputText value="Авторы пакета #{packageDetails.authors}"/></li>
            <li><h:outputText value="Владельцы пакета #{packageDetails.owners}"/></li>
            <li><h:outputLink  value="#{packageDetails.projectUrl}">URL проекта</h:outputLink></li>
            <li><h:outputText value="Примечания к релизу #{packageDetails.releaseNotes}"/></li>
            <li>
                <label for="requireLicenseAcceptance">Требуется подтверждение лицензии</label>
                <h:selectBooleanCheckbox id="requireLicenseAcceptance" value="#{packageDetails.requireLicenseAcceptance}"/>
            </li>
            <li><h:outputLink  value="#{packageDetails.licenseUrl}">URL лицензии</h:outputLink></li>
            <li><h:outputText value="Аннотация #{packageDetails.summary}"/></li>
            <li><h:outputText value="Права #{packageDetails.copyright}"/></li>
            <li><h:outputText value="Локализация #{packageDetails.language}"/></li>
            <li><h:outputText value="Теги #{packageDetails.tags}"/></li>
            <li>
                <h:link value="Содержимое пакета" outcome="packageContent">
                    <f:param name="storageId" value="#{packageDetails.storageName}"/>
                    <f:param name="packageId" value="#{packageDetails.packageId}"/>
                    <f:param name="packageVersion" value="#{packageDetails.packageVersion}"/>
                </h:link>
            </li>
            <li>
                <h:outputText value="Зависимости"/>
                <h:dataTable value="#{packageDetails.dependencies}" var="dependency">
                    <h:column>
                        <f:facet name="header">№</f:facet>
                        <h:outputText value="#{packageDetails.dependencies.rowIndex+1}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">Id</f:facet>
                        <h:link value="#{dependency.id}" outcome="packageDetails">
                            <f:param name="storageId" value="#{packageDetails.storageName}"/>
                            <f:param name="packageId" value="#{dependency.id}"/>
                            <f:param name="packageVersion" value="#{dependency.versionRangeString}"/>
                        </h:link>
                    </h:column>
                    <h:column>
                        <f:facet name="header">Versions</f:facet>
                        <h:outputText value="#{dependency.versionRangeString}"/>
                    </h:column>
                </h:dataTable>
            </li>
        </ul>
        <a href="#{packageDetails.rootUrl}/storages/#{packageDetails.storageName}/download/#{packageDetails.packageId}/#{packageDetails.packageVersion}">Закачать</a>
    </ui:define>
</ui:composition>

